package com.AJava1710D.xiancheng;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * 作者: LCG
 * 日期: 2020/6/23 08:49
 * 描述:
 */
public class Test01Thred {

    public static void main(String[] args) throws InterruptedException, ExecutionException {


       /* Thread thread=new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("========1====执行自己的任务======");
            }
        });

        thread.start();*/
/*
       List<Integer> list=new ArrayList<Integer>();
        RunableB runableB1 = new RunableB(list);
        RunableB runableB2 = new RunableB(list);

        Thread threadA=new Thread(runableB1);

        threadA.start();

        Thread threadB=new Thread(runableB1);

        threadB.start();

        threadA.join();
        threadB.join();

        System.out.println("=========>"+list.size());*/

        //如果我们的线程需要有返回值

        FutureTask<String> futureTask=new FutureTask<>(new CallAbleAA());

        Thread thread2=new Thread(futureTask);

        thread2.start();

        FutureTask<String> futureTask3=new FutureTask<>(new CallAbleAA());

        Thread thread3=new Thread(futureTask3);

        thread3.start();

        thread2.join();
        thread3.join();

        String s = futureTask.get();
        String s3 = futureTask3.get();

        System.out.println(s+"========"+s3);




    }

}
